package com.yh.rbac.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.yh.rbac.dao.RolePermissionMapper;
import com.yh.rbac.entity.RolePermission;
import com.yh.rbac.service.RolePermissionService;

@Service
public class RolePermissionServiceImpl implements RolePermissionService {

	@Resource
	private RolePermissionMapper rolePermissionMapper ;
	@Transactional(propagation = Propagation.REQUIRED)
	@Override
	public int insert(RolePermission record) {
		return rolePermissionMapper.insert(record) ;
	}

	@Override
	public List<RolePermission> selectAll() {
		return rolePermissionMapper.selectAll() ;
	}

	@Override
	public List<RolePermission> selectByRid(Long rid) {
		return rolePermissionMapper.selectByRid(rid);
	}

	@Transactional(propagation = Propagation.REQUIRED)
	@Override
	public int deleteByRid(Long rid) {
		return rolePermissionMapper.deleteByRid(rid) ;
	}

	@Override
	public int deleteByRidOrPid(Long rid, Long pid) {
		return rolePermissionMapper.deleteByRidOrPid(rid, pid) ;
	}

}
